package com.yixing.tech.common.vo.s3;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.yixing.tech.common.base.BaseVO;
import com.yixing.tech.common.enums.UserType;
import com.yixing.tech.common.security.context.SessionUser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @author yixing tech
 * at 2021/12/21
 * describe：
 */
@Data
@Accessors(chain=true)
@NoArgsConstructor
@AllArgsConstructor
@JsonIgnoreProperties(allowSetters = true,value = {"password"},allowGetters = true)
public class UserVO extends BaseVO implements SessionUser {
    String name;
    String loginName;
    String password;
    RoleVO role;
    RoleVO selfRole;
    UserType type;
    String phone;
    Integer status;
    String token;
    String oldPassword;
    String headPic;
    String headPicUrl;
    Boolean isAdmin ;
    List<MenuVO> menuList;
    TenantVO tenant;
    List<ApplicationVO> applications;
    DepartmentVO department;
    String desc;
    String code;
    String email;
    String sessionKey;
    String unionId;
    String openId;

    /**
     * 组织编码
     * @return
     */
    String tenantCode;
    public UserVO clone1(){
        UserVO userVO = new UserVO();
        userVO.setId(getId());
        userVO.setName(getName());
        userVO.setLoginName(getLoginName());
        userVO.setTenantId(getTenantId());
        userVO.setIsAdmin(getIsAdmin());
        userVO.setToken(getToken());
        userVO.setRole(getRole());
        userVO.setSelfRole(getSelfRole());
        userVO.setDesc(getDesc());
        userVO.setCode(getCode());
        userVO.setEmail(getEmail());
        userVO.setSessionKey(getSessionKey());
        userVO.setUnionId(getUnionId());
        userVO.setDepartment(getDepartment());
        return userVO;
    }

    @Override
    public String toString() {
        return "UserVO{" +
                "name='" + name + '\'' +
                ", loginName='" + loginName + '\'' +
                ", password='" + password + '\'' +
                ", type=" + type +
                ", phone='" + phone + '\'' +
                ", status=" + status +
                ", token='" + token + '\'' +
                ", headPicUrl='" + headPicUrl + '\'' +
                ", isAdmin=" + isAdmin +
                ", applications=" + applications +
                ", desc='" + desc + '\'' +
                ", code='" + code + '\'' +
                ", email='" + email + '\'' +
                ", sessionKey='" + sessionKey + '\'' +
                ", id='" + id + '\'' +
                ", tenantId='" + tenantId + '\'' +
                '}';
    }
}
